package com.vector.controller;

import com.vector.mapper.AdminMapper;
import com.vector.pojo.Admin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
public class AdminController {

    @Autowired
    private AdminMapper adminMapper;

    @GetMapping("/toLogin")
    public Admin toLogin(@RequestParam("aname") String aname, @RequestParam("pwd") String pwd, @RequestParam("shenfen") String shenfen){
        System.out.println(aname);
        System.out.println(pwd);
        System.out.println(shenfen);
        if (shenfen.equals("管理员")){
            Admin admin = adminMapper.adminLogin(new Admin(0, aname, pwd));
            return admin;
        }else if (shenfen.equals("用户")){
            return new Admin(0,"目前仅支持管理员登录","目前仅支持管理员登录");
        }else {
            return new Admin(0,"目前仅支持管理员登录","目前仅支持管理员登录");
        }

    }


}
